package com.example.Controller;

import com.example.Entity.Message;
import com.example.Entity.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/aip/v1/auth/manager_login")
    public Message getAdmin(@RequestBody User user){
        Message message = new Message();
        User admin = userService.getAdmin(user);
        message.setToken(admin.getToken());
        message.setMessage("Success!");
        return message;
    }

}
